import itertools

id = [1,2,3]
count = 0
# 方法1: for循环
for i in itertools.cycle(id):
    print(f"i: {i}")

    count += 1
    if count == 10:
        break
""" 结果
1,2,3, 1,2,3, 1,2,3, ...
"""

# 方法2: 变量迭代
count = 0
cycle_id = itertools.cycle(id)
while True:
    x = next(cycle_id)
    print(f"x: {x}")

    count += 1
    if count == 10:
        break
    
""" 结果
1,2,3, 1,2,3, 1,2,3, ...
"""